﻿using FluentValidation.Attributes;
using Nop.Admin.Models.Stores;
using Nop.Plugin.Misc.MessageDesigner.Validators;
using Nop.Web.Framework;
using Nop.Web.Framework.Localization;
using Nop.Web.Framework.Mvc;
using System.Collections.Generic;
using System.Web.Mvc;

namespace Nop.Plugin.Misc.MessageDesigner.Models
{
    [Validator(typeof(MessageDesignValidator))]
    public partial class MessageDesignModel : BaseNopEntityModel, ILocalizedModel<MessageDesignLocalizedModel>
    {
        public MessageDesignModel()
        {
            Locales = new List<MessageDesignLocalizedModel>();
            AvailableStores = new List<StoreModel>();
            messageTemplateListLocalModel = new MessageTemplateListLocalModel();
        }

        [NopResourceDisplayName("Plugins.Misc.MessageDesigner.Fields.Name")]
        public string Name { get; set; }

        [NopResourceDisplayName("Plugins.Misc.MessageDesigner.Fields.Body")]
        [AllowHtml]
        public string Body { get; set; }

        [NopResourceDisplayName("Plugins.Misc.MessageDesigner.Fields.AdminComment")]
        public string AdminComment { get; set; }

        //Store mapping
        [NopResourceDisplayName("Plugins.Misc.MessageDesigner.Fields.LimitedToStores")]
        public bool LimitedToStores { get; set; }
        [NopResourceDisplayName("Plugins.Misc.MessageDesigner.Fields.AvailableStores")]
        public List<StoreModel> AvailableStores { get; set; }
        public int[] SelectedStoreIds { get; set; }
        //comma-separated list of stores used on the list page
        [NopResourceDisplayName("Plugins.Misc.MessageDesigner.Fields.LimitedToStores")]
        public string ListOfStores { get; set; }

        public bool Selected { get; set; }
        public bool IsCreate { get; set; }
        public MessageTemplateListLocalModel messageTemplateListLocalModel { get; set; }

        public IList<MessageDesignLocalizedModel> Locales { get; set; }
    }

    public partial class MessageDesignLocalizedModel : ILocalizedModelLocal
    {
        public int LanguageId { get; set; }

        [NopResourceDisplayName("Plugins.Misc.MessageDesigner.Fields.Body")]
        [AllowHtml]
        public string Body { get; set; }
    }
}